package br.com.cadele.beans;

import java.io.Serializable;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import br.com.cadele.model.Curso;
import br.com.cadele.service.CursoService;

import com.ocpsoft.pretty.faces.annotation.URLBeanName;
import com.ocpsoft.pretty.faces.annotation.URLMapping;

@ManagedBean(name="cadastrarCursoBean")
@ViewScoped
@URLBeanName(value="cadastrarCursoBean")
@URLMapping(id="cadastrarCursoBean", pattern="/curso/cadastrar", viewId="/pages/curso/cadastrar.xhtml")
public class CadastrarCursoBean implements Serializable{

	private static final long serialVersionUID = -623897616205793474L;
	private Curso curso;
	private CursoService cursoService;

	@PostConstruct
	public void init(){
		curso = new Curso();
		cursoService = new CursoService();
	}
	
	public void salvar() {
		cursoService.executeInsert(curso);
	}
	
	public Curso getCurso() {
		return curso;
	}
	
	public void setCurso(Curso curso) {
		this.curso = curso;
	}
}
